import { PartialType } from '@nestjs/mapped-types';
import { CreateUserDto } from './create-user.dto';
import { IsArray } from 'class-validator';
import { Exclude, Expose, Transform } from 'class-transformer';

export class PublicUpdateUserDto extends PartialType(CreateUserDto) {
    @Exclude()
    password?: string;

    @IsArray()
    @Expose({ name: 'UserRole'})
    @Transform(({ value }) => value.map(item => item.roleId))
    roleIds: number[];
}
